﻿Imports Alquilaqi
Public Class AgregarCentroInmueble

    Public inmuebleAgregar As InmuebleAgregar

    Private Sub Buscar2bt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscar2bt.Click

        Dim criterio As String = Me.buscaT.Text
        'MsgBox(criterio)

        Dim negocio As New CentroEstudioNegocio
        Dim distrito As Collection = negocio.buscarPorNombre(criterio)
        Me.dgcentro.DataSource = distrito
        Me.dgcentro.EditMode = False

        If distrito.Count > 0 Then
            Me.dgcentro.Columns(0).HeaderText = "Id"
            Me.dgcentro.Columns(1).HeaderText = "Distrito"
            Me.dgcentro.Columns(2).HeaderText = "Nombre"
            Me.dgcentro.Columns(3).HeaderText = "Dirección"
        End If

        With Me.dgcentro.ColumnHeadersDefaultCellStyle
            .BackColor = Color.Red
            .ForeColor = Color.White
        End With
    End Sub

    Private Sub Seleccionar2bt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Seleccionar2bt.Click
        Dim seleccionado = Me.dgcentro.CurrentRow.Cells(0).Value.ToString

        Me.inmuebleAgregar.idcentroM.Text = seleccionado
        Me.Close()
        'Dim form As New InmuebleAgregar
        'form.idcentroM.Text = seleccionado
        'form.agregarCentroi = Me
        'form.Show()
    End Sub
End Class